home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part2 / 14452 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.7 KB

  1. Path: keats.ugrad.cs.ubc.ca!not-for-mail
  2. From: c2a192@ugrad.cs.ubc.ca (Kazimir Kylheku)
  3. Newsgroups: comp.lang.perl.misc,comp.lang.c
  4. Subject: Re: PROGRAMERS OF ANY LANGUAGE
  5. Date: 14 Apr 1996 14:40:28 -0700
  6. Organization: Computer Science, University of B.C., Vancouver, B.C., Canada
  7. Message-ID: <4krrccINN78i@keats.ugrad.cs.ubc.ca>
  8. References: <Pine.SOL.3.91.960329010021.13209A-100000@harvey> <4kqe6q$1tm@innocence.interface-business.de> <4kr869INN35k@keats.ugrad.cs.ubc.ca> <4krg5h$7tt@nntp1.best.com>
  9. NNTP-Posting-Host: keats.ugrad.cs.ubc.ca
  10.  
  11. In article <4krg5h$7tt@nntp1.best.com>, Zenin  <zenin@best.com> wrote:
  12.  >Kazimir Kylheku <c2a192@ugrad.cs.ubc.ca> wrote:
  13.  >    >snip<
  14.  >: The programmer is forced to ``disambiguate'':
  15.  >:     if (....) {
  16.  >:         if (....) {    
  17.  >:             if (....) {
  18.  >:                 statement;
  19.  >:             }
  20.  >:         }
  21.  >:     } else {
  22.  >:         statement;
  23.  >:     }
  24.  >: What a PITA. (And I ain't referring to an Italian meal also known as a pizza
  25.  >: pocket, either).
  26.  >
  27.  >    You don't program much, do you? :)
  28.  
  29. Actually I do program much. I wouldn't talk if I were you, read on...
  30.  
  31.  >        if( ... && ... && ... ) {
  32.  >            statement;
  33.  >        } else {
  34.  >            statement;
  35.  >        }
  36.  
  37. In your if statement, the else clause gets executed if *any one* of the
  38. test expressions fails! ``if (1 && 1 && 0)'' will launch into the *else* clause.
  39.  
  40. In MY if statement, the else clause only gets executed it the *outermost* test
  41. condition fails. ``if (1) if (1) if (0) statement 1; else statement2;'' will
  42. cause *neither* statement1 *nor* statement2 to be executed!
  43.  
  44. See, the two are not equivalent at all!
  45.  
  46. Who is it who doesn't program much?
  47.  
  48. ... and I still think Perl's handling of the classic if/then ambiguity during
  49. LR parsing is a lame copout. But I like it very much otherwise...
  50.